#include "d_logger.h"

#include <QDebug>

void dLog(QString msg, LogLevel lvl) {
    DLogger::getInstance().dLog(msg, lvl);
}

DLogger* DLogger::singleton = NULL;

DLogger::DLogger(QTextEdit* output) :
output(output)
{}

DLogger& DLogger::getInstance() {
    if(!singleton)
        qDebug() << "DLogger wasn't initialized";
    else {
        return *singleton;
    }
}

DLogger::~DLogger() {}

void DLogger::initialize(QTextEdit* output) {
    singleton = new DLogger(output);
}

void DLogger::dLog(QString msg, LogLevel lvl) {
    output->append(msg);
}
